import requests  
  
# 定义InfluxDB的主机和端口  
influx_host = 'aigowifi'  
influx_port = '8086'  
  
# 定义数据库名称和测量名称  
database_name = 'winccoa'  
measurement_name = 'AI_FAST.AI_FAST'  
field = 'original_value_float'
# 定义用户名和密码  
username = 'etm'  
password = 'etm#123'  
dpe='MEP:F1_CUB_1_1_102_XF_TIT01.STATE.VAL_IN.VALUE'
t0='2023-07-14T15:00:00Z'
t1='2023-07-14T20:00:00Z'
# 构建查询语句  
url = f"http://{influx_host}:{influx_port}/query"  
query = f"SELECT {field} FROM {measurement_name} WHERE \"name\" = '{dpe}' AND time > '{t0}' AND time<'{t1}'"  
# 发送HTTP请求并获取响应  
response = requests.get(url, params={'q': query, 'db': database_name}, auth=(username, password))  
  
# 检查响应状态码，并解析JSON数据  
if response.status_code == 200:
    data = response.json()  
    # 打印结果  
    print(data) 
    print(query)  
else:
    print(f"Error: {query},{response.text}")